import { Form } from 'ant-design-vue'
import { ref } from 'vue'

const { useForm } = Form

export function useConfigForm() {
  const formModel = ref({
    configName: '',
    configKey: '',
    configValue: '',
    configType: 'Y',
    remark: ''
  } as ICreateConfigDTO)
  const formRules = ref({
    configName: [{ required: true, message: '参数名称不能为空' }],
    configKey: [{ required: true, message: '参数键名不能为空' }],
    configValue: [{ required: true, message: '参数键值不能为空' }]
  } as FormRules<ICreateConfigDTO>)
  const formRef = useForm(formModel, formRules)

  return {
    formModel,
    formRef
  }
}
